import { Injectable } from '@nestjs/common'
import { Prisma } from '@prisma/client'
import { PrismaService } from 'src/prisma/prisma.service'

@Injectable()
export class CategoryService {
  constructor(private readonly prismaService: PrismaService) {}

  async createCategory(data: Prisma.CategoryCreateInput) {
    const category = await this.prismaService.category.create({
      data
    })
    return category
  }

  async getCategorys() {
    const categorys = await this.prismaService.category.findMany()
    return categorys
  }
}
